# Command Line Tool

{props.name || 'Module Federation'} provides lightweight command-line tools: {(props.cmdTools || ['@module-federation/enhanced', '@module-federation/modern-js']).map((cmdTool,index,arr)=>(<><code>{cmdTool}</code>{index+1===arr.length ? '':' and '}</>))} .

## View All Commands

import React from 'react';
import ViewAllCmdsMdx from '@components/common/cli/view-all-cmds-en';

{/* rspress flattenMdxContent issue  */}
{props.show || React.createElement(ViewAllCmdsMdx)}

## Common Options

{props.name || 'Module Federation'} CLI provides some common options that can be used for all commands:

| Option                       | Description                                                                                                              |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `-c, --config <config>`    | Specify the configuration file path, which can be a relative or absolute path. The default value is {props.configName ? props.configName : 'module-federation.config.ts' }      |
| `-m, --mode <mode>`        | Specify the running environment, you can choose "dev" or "prod". The default value is "dev". After setting, "development" or "production" will be automatically injected into the `process.env.NODE_ENV` environment variable according to the value.   |
| `-h, --help`               | Show command help                                                                                                      |

## {props.cmd || 'mf'} dts

  The <code>{props.cmd || 'mf'} dts</code> command is used to pull or generate TypeScript type declaration files.

import CommandInfo from '@components/common/cli/cmd-info';

{props.commandInfo || <CommandInfo />}

:::info 注意

The <code>{props.cmd || 'mf'} dts</code> command will automatically generate or pull type declaration files based on the configuration in <code>{props.configName || 'module-federation.config.ts'}</code>. This means you must provide a valid configuration file, otherwise the command will not run correctly.

If you are only using the runtime API, you need to create a temporary <code>{props.configName || 'module-federation.config.ts'}</code> file, configure [dts.consumeTypes.remoteTypeUrls](../../configure/dts#remotetypeurls), and then run the `mf dts` command.

:::
